Class TimeDifference

Summary

Fully Qualified Name: CodeIgniter\I18n\TimeDifference

Description

Class TimeDifference

Methods

Name Description Defined By
__construct() Note: both parameters are required to be in the same timezone. No timezone shifting is done internally. TimeDifference
__get() Allow property-like access to our calculated values. TimeDifference
__isset() Allow property-like checking for our calculated values. TimeDifference
getDays() Returns the number of days difference between the two dates. TimeDifference
getHours() Returns the number of hours difference between the two dates. TimeDifference
getMinutes() Returns the number of minutes difference between the two dates. TimeDifference
getMonths() Returns the number of months difference between the two dates. TimeDifference
getSeconds() Returns the number of seconds difference between the two dates. TimeDifference
getWeeks() Returns the number of weeks difference between the two dates. TimeDifference
getYears() Returns the number of years of difference between the two. TimeDifference
humanize() Convert the time to human readable format TimeDifference

Method Details

__construct()

Note: both parameters are required to be in the same timezone. No timezone shifting is done internally.

Parameter Name Type Description
$currentTime \DateTime
$testTime \DateTime

Returns:

__get()

Allow property-like access to our calculated values.

Parameter Name Type Description
$name
$name

Returns: mixed

__isset()

Allow property-like checking for our calculated values.

Parameter Name Type Description
$name
$name

Returns: bool

getDays()

Returns the number of days difference between the two dates.

Parameter Name Type Description
$raw bool

Returns: float|int

getHours()

Returns the number of hours difference between the two dates.

Parameter Name Type Description
$raw bool

Returns: float|int

getMinutes()

Returns the number of minutes difference between the two dates.

Parameter Name Type Description
$raw bool

Returns: float|int

getMonths()

Returns the number of months difference between the two dates.

Parameter Name Type Description
$raw bool

Returns: float|int

getSeconds()

Returns the number of seconds difference between the two dates.

Parameter Name Type Description
$raw bool

Returns: int

getWeeks()

Returns the number of weeks difference between the two dates.

Parameter Name Type Description
$raw bool

Returns: float|int

getYears()

Returns the number of years of difference between the two.

Parameter Name Type Description
$raw bool

Returns: float|int

humanize()

Convert the time to human readable format

Parameter Name Type Description
$locale string|null

Returns: string

Top